<?php

use kartik\daterange\DateRangePicker;
use yii\widgets\ActiveForm;
use yii\widgets\LinkPager;
use common\helpers\Url;
use common\helpers\Html;

$this->title                   = '会员资产';
$this->params['breadcrumbs'][] = ['label' => $this->title];
?>

<div class="row">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header">
                <h3 class="box-title"><?= $this->title; ?></h3>
                <div class="box-tools">
                    <?= Html::a('Excel 导出', ['excel'], ['class' => "btn btn-primary btn-xs"]); ?>
                </div>

                <div class="col-sm-12" style="margin-top: 10px;">
                    <?php $form = ActiveForm::begin([
                        'action' => Url::to(['index']),
                        'method' => 'get',
                    ]); ?>

                    <div class="col-sm-4">
                        <div class="input-group">

                            <?= Html::textInput('keyword', $keyword, [
                                'class' => 'form-control',
                                'id' => 'test-input',
                                'placeholder' => '请输入用户名或手机号',
                            ]) ?>

                            <span class="input-group-btn"><button class="btn btn-white"><i
                                            class="fa fa-search"></i> 搜索</button></span>

                        </div>
                    </div>

                    <?php ActiveForm::end(); ?>

                </div>
            </div>
            <div class="box-body table-responsive">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th>用户名</th>
                        <th>余额</th>
                        <th>占用</th>
                        <th>冻结</th>
                        <th>总盈利</th>
                        <th>总亏损</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php foreach ($models as $key => $model) { ?>
                        <tr id= <?= $model['member_id']; ?>>
                            <td><?= $key + 1; ?></td>
                            <td><?= $model['username']; ?></td>
                            <td><?= $model['price']; ?></td>
                            <td><?= empty($model['order_deposit'])?0.00:$model['order_deposit']; ?></td>
                            <td><?= $model['price_blocked']<=0 ? 0.00:$model['price_blocked']; ?></td>
                            <td><?= $model['price_profit']; ?></td>
                            <td><?= $model['price_loss']; ?></td>
                            <td>
                                <?= Html::edit(['gift', 'id' => $model['member_id']],'赠金',[
                                    'data-toggle' => 'modal',
                                    'data-target' => '#ajaxModal',
                                    'class'=>'btn btn-sm btn-success',
                                ]); ?>
                            </td>
                        </tr>
                    <?php } ?>
                    </tbody>
                </table>
            </div>
            <div class="box-footer">
                <p> <span style="color: blue">总余额：<?= $member->price; ?></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <span style="color: blue">总占用金额：<?= $member->price_occupy; ?></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <span style="color: blue">总盈利金额：<?= $member->price_profit; ?></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <span style="color: blue">总亏损金额：<?= $member->price_loss; ?></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <span style="color: blue">总冻结金额：<?= $member->price_blocked; ?></span>
                </p>
                <?= LinkPager::widget([
                    'pagination' => $pages,
                ]); ?>
            </div>

        </div>
    </div>
</div>